package com.gfxy.educational.model;

public enum CourseArrangementEnum {



    FIRST(1,"1-2节课"),SECOND(2,"3-4节课"),
    THIRD(3,"5-6节课"),FOURTH(4,"7-8节课"),
    FIFTH(5,"9-10节课");


    private final int index;
    private final String name;
    CourseArrangementEnum(int i, String s) {
        index = i;
        name = s;
    }

    public static CourseArrangementEnum getCourseArrangementEnumById(int id){
        CourseArrangementEnum result = null;
        for(CourseArrangementEnum courseArrangementEnum : CourseArrangementEnum.values()){
            if(courseArrangementEnum.getIndex() == id){
                result = courseArrangementEnum;
                break;
            }
        }
        if(result == null){
            throw new IllegalArgumentException("错误的枚举id值[" + id + "], 无法找到对应的枚举");
        } else {
            return result;
        }

    }

    public int getIndex() {
        return index;
    }

    public String getName() {
        return name;
    }
}
